/**
 * The MIT License
 * <p>
 * Copyright (c) 2017
 */
package com.seelyn.flow.engine;

import java.util.Map;
import java.util.logging.Logger;

/**
 * Main entry point to create {@link WorkFlowEngine} instances.
 *
 * @author slacrey  (237242115@qq.com)
 */
public class WorkFlowEngineBuilder {

    private static final Logger LOGGER = Logger.getLogger(WorkFlowEngineBuilder.class.getName());

    private final WorkFlowParams workFlowParams;

    /**
     * Create a new {@link WorkFlowEngineBuilder}.
     *
     * @return a new {@link WorkFlowEngineBuilder}.
     */
    public static WorkFlowEngineBuilder aNewWorkFlowEngine() {
        return new WorkFlowEngineBuilder();
    }

    private WorkFlowEngineBuilder() {
        this.workFlowParams = new WorkFlowParams();
    }

    public WorkFlowEngineBuilder params(Map<String, Object> params) {
        this.workFlowParams.putAll(params);
        return this;
    }

    public WorkFlowEngineBuilder params(String key, Object obj) {
        this.workFlowParams.put(key, obj);
        return this;
    }

    /**
     * Create a new {@link WorkFlowEngine}.
     *
     * @return a new {@link WorkFlowEngine}.
     */
    public WorkFlowEngine build() {
        return new WorkFlowEngineImpl(this.workFlowParams);
    }
}
